package com.mt.roll.common.service.impl;

import com.mt.roll.common.service.DataDictionaryService;
import com.mt.roll.common.vo.DataDictionaryVo;
import com.mt.roll.core.base.BaseService;
import com.mt.roll.core.dal.entity.Equipment;
import com.mt.roll.core.dal.entity.EquipmentType;
import com.mt.roll.core.dal.service.EquipmentServiceBiz;
import com.mt.roll.core.dal.service.EquipmentTypeServiceBiz;
import com.mt.roll.core.params.IdParam;
import com.mt.roll.core.utils.BeanUtils;
import com.mt.roll.core.vo.R;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.List;

/**
 * 数据字典服务实现类
 * @Author: liguanghao
 * @Date: 2021/1/20 14:25
 * @Version 1.0
 */
@Service
@Transactional
public class DataDictionaryServiceImpl extends BaseService implements DataDictionaryService {

    @Resource
    private EquipmentTypeServiceBiz equipmentTypeServiceBiz;
    @Resource
    private EquipmentServiceBiz equipmentServiceBiz;


    @Override
    public R<List<DataDictionaryVo>> equipmentTypeList() {
        List<EquipmentType> list = equipmentTypeServiceBiz.list();
        List<DataDictionaryVo> dataDictionaryVos = BeanUtils.copyList(list, DataDictionaryVo.class);
        return successful(dataDictionaryVos);
    }

    @Override
    public R<List<DataDictionaryVo>> equipmentList() {
        List<Equipment> list = equipmentServiceBiz.list();
        List<DataDictionaryVo> dataDictionaryVos = BeanUtils.copyList(list, DataDictionaryVo.class);
        return successful(dataDictionaryVos);
    }

    @Override
    public R<List<DataDictionaryVo>> equipmentRecipeList(IdParam idParam) {
        return null;
    }
}
